import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SaleTotalVO, SaleTotalForm, SaleTotalQuery } from '@/api/lingxing/saleTotal/types';

/**
 * 查询领星销量相关统计列表
 * @param query
 * @returns {*}
 */

export const listSaleTotal = (query?: SaleTotalQuery): AxiosPromise<SaleTotalVO[]> => {
  return request({
    url: '/lingxing/saleTotal/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询领星销量相关统计详细
 * @param id
 */
export const getSaleTotal = (id: string | number): AxiosPromise<SaleTotalVO> => {
  return request({
    url: '/lingxing/saleTotal/' + id,
    method: 'get'
  });
};

/**
 * 新增领星销量相关统计
 * @param data
 */
export const addSaleTotal = (data: SaleTotalForm) => {
  return request({
    url: '/lingxing/saleTotal',
    method: 'post',
    data: data
  });
};

/**
 * 修改领星销量相关统计
 * @param data
 */
export const updateSaleTotal = (data: SaleTotalForm) => {
  return request({
    url: '/lingxing/saleTotal',
    method: 'put',
    data: data
  });
};

/**
 * 删除领星销量相关统计
 * @param id
 */
export const delSaleTotal = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lingxing/saleTotal/' + id,
    method: 'delete'
  });
};

/**
 * 同步领星接口
 * @returns {*}
 */
export const syncData = () => {
  return request({
    url: '/lingxing/saleTotal/syncData',
    method: 'post'
  });
};
